/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Views.GestionClient;

import Controller.Controller;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
import javax.swing.border.Border;

/**
 *
 * @author ibrahim
 */
public class ClientCreationPanel extends JPanel {
    
   
    private JLabel firstNameLabel;
    private JLabel lastNameLabel;
    private JLabel adressLabel;
    private JLabel numstreetLabel;
    private JLabel cityLabel;
    private JLabel postalCodeLabel;
    private JLabel streetLabel;
    private JLabel birthdayLabel;
    private JLabel telephonenumberLabel;
    private JLabel emailLabel;
    private JLabel usernameLabel;
    private JLabel passwordLabel;
    private JTextField firstNameField;
    private JTextField lastNameField;
    private JTextField numstreetField;
    private JTextField streetField;
    private JTextField cityField;
    private JTextField postalCodeField;
    private SpinnerNumberModel daySpinnerModel;
    private SpinnerNumberModel monthSpinnerModel;
    private SpinnerNumberModel yearSpinnerModel;
    private JSpinner daySpinner;
    private JSpinner monthSpinner;
    private JSpinner yearSpinner;
    private JTextField telephField;
    private JTextField emailField;
    private JTextField usernameField;
    private JPasswordField passwordField;
    private JButton creerButton;
    private JButton cancelButton;
    
    public ClientCreationPanel(){
        
    Dimension dim =getPreferredSize();
    dim.width=200;
    setPreferredSize(dim);  
    
    Border innerBorder = BorderFactory.createTitledBorder("Gestion Restaurant");
    Border outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5);
    setBorder(BorderFactory.createCompoundBorder(outerBorder, innerBorder));
    
    setLayout(new GridBagLayout());
    GridBagConstraints gc = new GridBagConstraints();
    this.daySpinnerModel = new SpinnerNumberModel(1,1,31,1);
    this.monthSpinnerModel = new SpinnerNumberModel(1,1,12,1);
    this.yearSpinnerModel = new SpinnerNumberModel(1992,1,9999,1);
    this.daySpinner = new JSpinner(daySpinnerModel);
    this.monthSpinner = new JSpinner(monthSpinnerModel);
    this.yearSpinner = new JSpinner(yearSpinnerModel);
    this.firstNameLabel = new JLabel("Prenom*: ");
    this.lastNameLabel = new JLabel("Nom*: ");
    this.adressLabel = new JLabel("Adresse: ");
    this.numstreetLabel = new JLabel("Numero: ");
    this.streetLabel = new JLabel("Rue: ");
    this.numstreetLabel = new JLabel("Numero: ");
    this.cityLabel = new JLabel("Ville: ");
    this.postalCodeLabel = new JLabel("Code postal: ");
    this.birthdayLabel = new JLabel("Data de naissance (jj/mm/aaaa): ");
    this.telephonenumberLabel = new JLabel("Numero de telephone: ");
    this.emailLabel = new JLabel("Courriel: ");
    this.usernameLabel = new JLabel("Nom d'usager: ");
    this.passwordLabel = new JLabel("Mot de passe: ");
    this.creerButton = new JButton("Creer compte");
    this.cancelButton = new JButton("Annuler");
    this.firstNameField = new JTextField(10);
    this.lastNameField = new JTextField(10);
    this.numstreetField = new JTextField(10);
    this.streetField = new JTextField(10);
    this.cityField = new JTextField(10);
    this.postalCodeField = new JTextField(10);
    Dimension btnSize = creerButton.getPreferredSize();
    cancelButton.setPreferredSize(btnSize);
    
    gc.weightx=1;
    gc.weighty=0.2;
    gc.gridy=0;
    gc.gridx=0;
    
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.LINE_END;
    gc.insets = new Insets (5,5,5,5);
    add(this.firstNameLabel,gc);
    //////////
    gc.gridx=1;
   
    gc.anchor = GridBagConstraints.LINE_START;
    gc.insets = new Insets (0,0,0,0);
    add(this.firstNameField,gc);
    //////////
    gc.gridx=2;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.LINE_END;
    gc.insets = new Insets (0,0,0,5);
    add(this.lastNameLabel,gc);
    //////////
    gc.gridx=3;
    gc.anchor = GridBagConstraints.LINE_START;
    gc.insets = new Insets (0,0,0,0);
    add(this.lastNameField,gc);
    //////////

    gc.gridy=1;
    gc.gridx=0;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.LINE_END;
    gc.insets = new Insets (0,0,0,5);
    add(this.numstreetLabel,gc);
    //////////
    gc.gridx=1;
    gc.gridy=1;
    gc.anchor = GridBagConstraints.LINE_START;
    gc.insets = new Insets (0,0,0,0);
    add(this.numstreetField,gc);
    //////////
    gc.gridy=1;
    gc.gridx=2;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.LINE_END;
    gc.insets = new Insets (0,0,0,5);
    add(this.streetLabel,gc);
    //////////
    gc.gridx=3;
    gc.gridy=1;
    gc.anchor = GridBagConstraints.LINE_START;
    gc.insets = new Insets (0,0,0,0);
    add(this.streetField,gc);
    //////////
   
    gc.gridy=2;
    gc.gridx=0;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.LINE_END;
    gc.insets = new Insets (0,0,0,5);
    add(this.cityLabel,gc);
    //////////
    gc.gridx=1;
    gc.gridy=2;
    gc.anchor = GridBagConstraints.LINE_START;
    gc.insets = new Insets (0,0,0,0);
    add(this.cityField,gc);
    //////////
    gc.gridy=2;
    gc.gridx=2;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.LINE_END;
    gc.insets = new Insets (0,0,0,5);
    add(this.postalCodeLabel,gc);
    //////////
    gc.gridx=3;
    gc.gridy=2;
    gc.anchor = GridBagConstraints.LINE_START;
    gc.insets = new Insets (0,0,0,0);
    add(this.postalCodeField,gc);
    //////////
    
    gc.gridy=3;
    gc.gridx=0;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.LINE_END;
    gc.insets = new Insets (0,0,0,5);
    add(this.birthdayLabel,gc);
    //////////
    gc.gridx=1;
    gc.gridy=3;
    gc.anchor = GridBagConstraints.CENTER;
    gc.insets = new Insets (0,0,0,0);
    add(this.daySpinner,gc);
    //////////
    gc.gridy=3;
    gc.gridx=2;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.CENTER;
    gc.insets = new Insets (0,0,0,5);
    add(this.monthSpinner,gc);
    //////////
    gc.gridx=3;
    gc.gridy=3;
    gc.anchor = GridBagConstraints.CENTER;
    gc.insets = new Insets (0,0,0,0);
    add(this.yearSpinner,gc);
    
    
    }
}
